package com.ldtechnologies.springapp.controller;

import java.io.IOException;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class WellcomeController {
	protected final Log logger = LogFactory.getLog(getClass());
	
	@RequestMapping(value="/wellcome.htm")
	public ModelAndView wellcome( HttpServletRequest request, 
								  HttpServletResponse response	)
								  throws IOException, ServletException{
		logger.info("Wellcome!!!!");
		ModelAndView mv = new ModelAndView("wellcome");
		mv.addObject("serverName", request.getServerName());
		mv.addObject("other", request.getRemoteAddr());
		mv.addObject("now", (new Date()).toString() );
		return mv;
	}	
}
